#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int* sortedSquares(int* A, int ASize){
	int* cur1 = A;
	int* cur2 = A;
	int i = 0;
	while (i<ASize)
	{
		cur1[i] = cur1[i] * cur1[i];
		i++;
	}
	for (int j = 0; j<ASize - 1; j++)
	{
		for (int k = 0; k<ASize - j - 1; k++)
		{
			if (cur2[k]>cur2[k + 1])
			{
				int tem = cur2[k + 1];
				cur2[k + 1] = cur2[k];
				cur2[k] = tem;
			}
		}
	}
	return A;
}

int main()
{
	int arr[] = { -4, -1, 0, 3, 10 };
	int* A = sortedSquares(arr, 5);
	for (int i = 0; i < 5; i++)
	{
		printf("%d\n", A[i]);
	}

	system("pause");
	return 0;
}